package com.example.javatwo.controller.xs.zqy;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.hibernate.validator.internal.util.IgnoreJava6Requirement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.javatwo.pojo.xs.zqy.PageBean;
import com.example.javatwo.pojo.xs.zqy.paymentmain;
import com.example.javatwo.service.xs.zqy.Ysservice;

@Controller
public class YsController {

	@Autowired
	private Ysservice ysservice;
	@RequestMapping("/demo")
	public String demo() throws Exception{
		return "xs/zqy/demo";
	}
	
	@ResponseBody
	@RequestMapping(value="/findYszhu",method=RequestMethod.POST)
	public PageBean findYszhu(int currentPage){
		Integer count = this.ysservice.findzong();
		Object pageobj = this.ysservice.findYszhu(currentPage);
		PageBean bean = new PageBean(count,currentPage, pageobj);
		return bean;
	}
	
	@ResponseBody
	@RequestMapping("/Insertzhu")
	public String Insertzhu(@RequestBody paymentmain zhu){
		System.out.println(zhu);
		this.ysservice.insertzhu(zhu);
		return "保存成功";
	}
	
	@ResponseBody
	@RequestMapping("/update")
	public String update(@RequestBody paymentmain zhu){
		System.out.println(zhu);
		this.ysservice.update(zhu);
		return "修改成功";
	}
	
	@ResponseBody
	@RequestMapping(value="/del",method=RequestMethod.POST)
	public String del(String fundbillno){
		System.out.println(fundbillno);
		this.ysservice.del(fundbillno);
		return "删除成功";
	}
}
